﻿using MVCTest.Models;
using MVCTest.Models.EntityFrameWork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVCTest.Helper;
namespace MVCTest.Controllers
{
    public class AccountController : Controller
    {
        //
        // GET: /Account/Login

        public ActionResult Login()
        {
            return View();
        }

        //POST:/Account/Login
        [HttpPost]
        public ActionResult Login(Users user)
        {

            if (UserHelper.Login(user))
            {

                return RedirectToAction("Index", "Home");
            }

            ViewBag.LoginError = "Geçersiz Kullanıcı";

            return View();
        }

        public ActionResult Register(Users user)
        {
            UserHelper.Register(user);
            return RedirectToAction("Index", "Home");
        }


    }
}
